﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class Recipe : MonoBehaviour, ICastable
{
    [SerializeField]
    private CraftingMaterial[] materials;
    [SerializeField]
    private Item outputItem;
    [SerializeField]
    private int outputCount;
    [SerializeField]
    private string description;
    [SerializeField]
    private Image borderSelection;
    [SerializeField]
    private float castTime;
    [SerializeField]
    private Color barColour;

    public CraftingMaterial[] MyMaterials { get => materials; }
    public Item OutputItem { get => outputItem; }
    public int OutputCount { get => outputCount; set => outputCount = value; }
    public string Description { get => description; }

    public string MyTitle { get => outputItem.MyTitle; }

    public float MyCastTime { get => castTime; }

    public Sprite MyIcon { get => outputItem.MyIcon; }

    public Color MyBarColour { get => barColour; }


    // Start is called before the first frame update
    void Start()
    {
        GetComponentInChildren<Text>().text = outputItem.MyTitle;   
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void Select()
    {
        Color c = borderSelection.color;
        c.a = 0.25f;
        borderSelection.color = c;
    }

    public void Deselect()
    {
        Color c = borderSelection.color;
        c.a = 0;
        borderSelection.color = c;
    }
}
